/**  
 * All rights Reserved, Designed By www.tydic.com
 * @Title:  OrderService.java   
 * @Package com.axin.service   
 * @Description:    TODO(用一句话描述该文件做什么)   
 * @author: axin     
 * @date:   2019年4月9日 下午11:01:22   
 * @version V1.0 
 * @Copyright: 2019 www.hao456.top Inc. All rights reserved. 
 */
package com.axin.service;

import java.util.List;

import com.axin.common.entity.ApiToken;
import com.axin.common.entity.request.CreateOrderRequest;
import com.axin.common.entity.request.IntrustOrdersDetailRequest;
import com.axin.common.entity.response.Batchcancel;
import com.axin.common.entity.response.BatchcancelResult;
import com.axin.common.entity.response.IntrustDetail;
import com.axin.common.entity.response.MatchresultsOrdersDetail;
import com.axin.common.entity.response.OrdersDetail;
import com.axin.common.entity.response.SubmitcancelResponse;
import com.axin.entity.bo.BuyResult;

/**   
 * @Description: 订单服务层 
 * @ClassName:  OrderService
 * @author:  Axin 
 * @date:   2019年4月9日 下午11:01:22   
 * @Copyright: 2019 www.hao456.top Inc. All rights reserved. 
 */
public interface OrderService {
	
	
	/**主动交易方向:购买*/
	public static final String BUY = "buy";
	/**主动交易方向:销售*/
	public static final String SELL = "sell";
	/**
	 * 创建订单
	 * @Description: TODO  
	 * @Title: createOrder   
	 * @param request
	 * @param token
	 * @return Long
	 * @throws
	 */
	public Long createOrder(ApiToken token, CreateOrderRequest request);
	
	
	/**
	 * 
	 * @Description: 创建限价购买订单  
	 * @Title: createBuyOrder   
	 * @param token
	 * @param symbol 购买的交易对
	 * @param accountId 购买的账户id
	 * @param amount 限价购买的数量
	 * @param price 限价购买的单价
	 * @return Long 
	 * @throws
	 */
	public Long createBuyOrder(ApiToken token, String symbol,Integer accountId,String amount,String price);
	
	
	/**
	 * @Description: 创建市价购买订单  
	 * @Title: createBuyOrder   
	 * @param token
	 * @param symbol 购买的交易对
	 * @param accountId 购买的账户id
	 * @param money 限价购入的金额
	 * @return Long
	 * @throws
	 */
	public Long createBuyOrder(ApiToken token, String symbol,Integer accountId,String money);
	
	
	
	/**
	 * 创建订单并获取交易祥情
	 * @Description: TODO  
	 * @Title: createBuyOrderWithDetail   
	 * @param token
	 * @param symbol
	 * @param accountId
	 * @param money void
	 * @throws
	 */
	public BuyResult createBuyOrderWithDetail(ApiToken token, String symbol, Integer accountId, String money,int moneyScale, int amountScale);
	
	
	/**
	 * @Description: 创建限价销售订单
	 * @Title: createSellOrder   
	 * @param token
	 * @param symbol
	 * @param accountId
	 * @param money
	 * @return Long
	 * @throws
	 */
	public Long createSellOrder(ApiToken token, String symbol,Integer accountId,String amount,String price);
	
	
	/**
	 * @Description: 创建市价销售订单
	 * @Title: createSellOrder   
	 * @param token
	 * @param symbol
	 * @param accountId
	 * @param money
	 * @return Long
	 * @throws
	 */
	public Long createSellOrder(ApiToken token, String symbol,Integer accountId,String money);
	/**
	 * 执行订单
	 * @Description: TODO  
	 * @Title: placeOrder   
	 * @param orderId
	 * @param token
	 * @return String
	 * @throws
	 */
	public String placeOrder(ApiToken token, long orderId);
	
	
	/**
	 * 查询订单祥情
	 * @Description: TODO  
	 * @Title: ordersDetail   
	 * @param token
	 * @param orderId
	 * @return OrdersDetail
	 * @throws
	 */
	public OrdersDetail ordersDetail(ApiToken token,long orderId);
	
	
	/**
	 * 查询某个订单的交易明细
	 * @Description: TODO  
	 * @Title: matchresults   
	 * @param token
	 * @param orderId
	 * @return MatchresultsOrdersDetail
	 * @throws
	 */
	public List<MatchresultsOrdersDetail> matchresults(ApiToken token,long orderId);
	

	
	/**
	 * 查询当前委托、历史委托
	 * @Title: getOrders   
	 * @param token
	 * @param req
	 * @return List<IntrustDetail>
	 * @throws
	 */
	public List<IntrustDetail> getOrders(ApiToken token,IntrustOrdersDetailRequest req);
	
	
	/**
	 * 根据订单id取消订单
	 * @Title: submitcancel   
	 * @param token
	 * @param orderId
	 * @return SubmitcancelResponse
	 * @throws
	 */
	public SubmitcancelResponse submitcancel(ApiToken token,long orderId);
	
	/**
	 * 根据订单id取消订单
	 * @Title: submitcancels   
	 * @param token
	 * @param orderIds
	 * @return Batchcancel
	 * @throws
	 */
	public Batchcancel submitcancel(ApiToken token, List orderIds);
	
	
	/**
	 * 取消符合条件的未成交订单
	 * @Description: TODO  
	 * @Title: submitcancel   
	 * @param token
	 * @param accountId
	 * @param symbol
	 * @param side “buy”或“sell”，缺省将返回所有符合条件尚未成交订单
	 * @return BatchcancelResult
	 * @throws
	 */
	public BatchcancelResult submitcancel(ApiToken token, Integer accountId,String symbol, String side);
	
	
	
}
